package cn.tedu.controller;

import cn.tedu.pojo.Phone;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("phone")
public class PhoneController {
    @RequestMapping("get6")
    public void get6(Phone phone){
        System.out.println(phone.getId()+phone.getName()+phone.getColor()+phone.getType());
    }

    @RequestMapping("get5")
    public void get5(Integer id,String name){
        System.out.println(id+name);
    }

    @RequestMapping("get4")
    public void get4(Integer id){
        System.out.println(id);
    }

    @RequestMapping("get3")
    public void get3(int id){
        System.out.println(id);
    }

    @RequestMapping("get2")
    public void get2() {
        String url = "http://localhost:8080/phone/get2?id=8848&name=钛金手机&color=黑色";
        String[]s=url.split("\\?")[1].split("&");
        for(String ss:s){
            String key = ss.split("=")[0];
            String value = ss.split("=")[1];
            System.out.println(key);

        }
    }

    @RequestMapping("get")
    public Phone get() {
        Phone phone = new Phone();
        phone.setId(8848);
        phone.setName("钛金手机");
        phone.setColor("黑色");
        phone.setType("tpc");
        System.out.println(phone);
        return phone;
    }
}
